<template>
  <div class="basic_wrap">
    <bsHeader
      :title="title"
      @backurl="$router.back()"
    />
    <div class="top_div">
      <div class="iframe">
        <!-- 客服图标 -->
        <!-- <div
          class="kefu"
          @click="kefu_to"
        >
          <img
            class="kefu_img"
            src="../img/index/kefu.png"
          >
        </div> -->
        <iframe
          :src="src"
          width="100%"
          height="400px"
        />
      </div>
      <!-- 新闻资讯 -->
      <div class="currency_tips">
        {{ $t('index.news') }}
      </div>
      <div class="block_div news_box">
        <div class="item">
          <van-cell
            v-for="(item,index) in news"
            :key="index"
            is-link
            @click="$router.push('article/'+item.id)"
          >
            <template #title>
              <div class="custom-title">
                {{ item.title }}
              </div>
              <div class=" time">
                {{ common.formatDate(item.time) }}
              </div>
            </template>
          </van-cell>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
	import Vue from 'vue';
	import bsHeader from '../../components/bsHeader.vue'
	import Fetch from '../../utils/fetch'
	import {
		Cell,
		CellGroup
	} from "vant";
	
	Vue.use(Cell).use(CellGroup);
	
	export default {
		name: "Market",
		components: {
			bsHeader
		},
		data() {
			return {
				title: this.$route.query.tvwidgetsymbol,
				src:"",
				news: [],
				
			};
		},
		created() {
			if (window.plus) {
				plus.navigator.setStatusBarBackground('#FFFFFF');
				plus.navigator.setStatusBarStyle('dark');
			}
			this.$parent.footer('user', false);
		},
		mounted() {
			var tvwidgetsymbol = this.$route.query.tvwidgetsymbol;
			if(tvwidgetsymbol=="NASDAQ:GEHC"){
				this.src = "../html/page1.html";
			}else if(tvwidgetsymbol=="NYSE:JNJ"){
				this.src = "../html/page2.html";
			}else if(tvwidgetsymbol=="NYSE:BDX"){
				this.src = "../html/page3.html";
			}else if(tvwidgetsymbol=="NYSE:MDT"){
				this.src = "../html/page4.html";
			}
			this.start();
		},
		methods: {
			start() {
				Fetch('/index/newsList').then(r => {
					this.news = r.data;
				})
			},
			kefu_to() {
				if (this.show_kefu) {
					this.$router.push('/service');
				}
				this.show_kefu = !this.show_kefu;
			},
		}
	};
</script>

<style lang="less" scoped>
	.top_div {
		margin-top: 55px;
		
		.iframe{
			position: relative;
			margin-bottom: 15px;
		}
		
		.currency_tips {
			margin-bottom: 10px;
			margin-left: 3%;
			border-left: 5px solid #0F6EFF;
			padding-left: 10px;
			font-size: 14px;
			font-weight: bold;
		}
		.news_box {
			margin-bottom: 15px;
		
			.item {
				.time {
					color: #999;
					font-size: 12px;
				}
			}
		}
		
	}
	
	.kefu{
		position: absolute;    
		left: 2%;
		bottom: 14%;
	}
</style>
